package com.sczmgk.track.activity.trackactivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Message;

import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.model.LatLng;
import com.sczmgk.track.R;
import com.sczmgk.track.base.CheckPermissionBaseActivity;
import com.sczmgk.track.db.impl.UserDaoImpl;
import com.sczmgk.track.entity.SignBean;
import com.sczmgk.track.entity.User;
import com.sczmgk.track.utils.MapUtil;

/**
 * Created by Administrator on 2017/9/27.
 * 检索
 */
public class SignDetailActivity extends CheckPermissionBaseActivity {
    private static final int REFRESH_UI = 123;
    private MapUtil mapUtil;
    private Double lat;
    private Double log;
    private SignBean sign;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_detail);
        setTitle(R.string.sign_title);
        Intent intent = getIntent();
        sign = (SignBean) intent.getSerializableExtra("location");
        lat = Double.valueOf(sign.maplat);
        log = Double.valueOf(sign.maplong);
        isShowLeftView(false);
        mapUtil = new MapUtil();
        mapUtil.init((MapView) findViewById(R.id.tracing_mapView));
        mapUtil.setMapStatus(new LatLng(lat, log), 15.0f);

        User loginUser = UserDaoImpl.getLoginUser(SignDetailActivity.this);
        String imagePath="";
        if(loginUser != null){
            imagePath = loginUser.imageLocalPath;

        }

        mapUtil.addMyMarker(new LatLng(lat, log), SignDetailActivity.this, imagePath);



    }




    @Override
    public void onSelectedPhonePermission(String phoneNumber) {

    }

    @Override
    public void onSelectedStroage(int position) {

    }

    @Override
    public void onSelectCamera(int position) {

    }

    @Override
    public boolean getIsNeedLogin() {
        return false;
    }



    @Override
    public void handleMessage(Message msg) {

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        mapUtil.clear();
       }


    @Override
    protected void onPause() {
        super.onPause();
        mapUtil.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mapUtil.onResume();
    }

}
